{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import zipfile\n",
    "import pandas as pd\n",
    "import sqlalchemy as sql\n",
    "from sqlalchemy import create_engine\n",
    "\n",
    "from database_config import db_postgres\n",
    "\n",
    "host, port, user, password, database = db_postgres()\n",
    "\n",
    "engine = sql.create_engine(f\"postgresql+psycopg2://{user}:{password}@{host}:{port}/{database}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "path = 'I:/Data/minzdrav'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Обрабатывается файл \"1\" : И38_успешные_сессии_20240229.csv\n"
     ]
    },
    {
     "ename": "ValueError",
     "evalue": "time data '2024-02-29' does not match format 'mixed' (match)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[6], line 28\u001b[0m\n\u001b[0;32m     25\u001b[0m file_data[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtotal_rows_in_file\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m file_data\u001b[38;5;241m.\u001b[39mshape[\u001b[38;5;241m0\u001b[39m]\n\u001b[0;32m     26\u001b[0m \u001b[38;5;66;03m# file_data = file_data.loc[:, ~file_data.columns.str.contains(' ')]\u001b[39;00m\n\u001b[0;32m     27\u001b[0m \u001b[38;5;66;03m# file_data.drop_duplicates(subset='session_id')\u001b[39;00m\n\u001b[1;32m---> 28\u001b[0m file_data[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdate_ts\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[43mpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mto_datetime\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfile_data\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mdate_ts\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mformat\u001b[39;49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mmixed\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[0;32m     29\u001b[0m file_data[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mslot_ts\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mto_datetime(file_data[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mslot_ts\u001b[39m\u001b[38;5;124m'\u001b[39m], \u001b[38;5;28mformat\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmixed\u001b[39m\u001b[38;5;124m'\u001b[39m, errors\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcoerce\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m     30\u001b[0m file_data[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcreate_ts\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mto_datetime(file_data[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcreate_ts\u001b[39m\u001b[38;5;124m'\u001b[39m], \u001b[38;5;28mformat\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmixed\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
      "File \u001b[1;32mc:\\Users\\oigla\\anaconda3\\lib\\site-packages\\pandas\\core\\tools\\datetimes.py:1064\u001b[0m, in \u001b[0;36mto_datetime\u001b[1;34m(arg, errors, dayfirst, yearfirst, utc, format, exact, unit, infer_datetime_format, origin, cache)\u001b[0m\n\u001b[0;32m   1062\u001b[0m             result \u001b[38;5;241m=\u001b[39m arg\u001b[38;5;241m.\u001b[39mtz_localize(tz)\n\u001b[0;32m   1063\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(arg, ABCSeries):\n\u001b[1;32m-> 1064\u001b[0m     cache_array \u001b[38;5;241m=\u001b[39m \u001b[43m_maybe_cache\u001b[49m\u001b[43m(\u001b[49m\u001b[43marg\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mformat\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcache\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mconvert_listlike\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m   1065\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m cache_array\u001b[38;5;241m.\u001b[39mempty:\n\u001b[0;32m   1066\u001b[0m         result \u001b[38;5;241m=\u001b[39m arg\u001b[38;5;241m.\u001b[39mmap(cache_array)\n",
      "File \u001b[1;32mc:\\Users\\oigla\\anaconda3\\lib\\site-packages\\pandas\\core\\tools\\datetimes.py:229\u001b[0m, in \u001b[0;36m_maybe_cache\u001b[1;34m(arg, format, cache, convert_listlike)\u001b[0m\n\u001b[0;32m    227\u001b[0m unique_dates \u001b[38;5;241m=\u001b[39m unique(arg)\n\u001b[0;32m    228\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(unique_dates) \u001b[38;5;241m<\u001b[39m \u001b[38;5;28mlen\u001b[39m(arg):\n\u001b[1;32m--> 229\u001b[0m     cache_dates \u001b[38;5;241m=\u001b[39m \u001b[43mconvert_listlike\u001b[49m\u001b[43m(\u001b[49m\u001b[43munique_dates\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mformat\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[0;32m    230\u001b[0m     \u001b[38;5;66;03m# GH#45319\u001b[39;00m\n\u001b[0;32m    231\u001b[0m     \u001b[38;5;28;01mtry\u001b[39;00m:\n",
      "File \u001b[1;32mc:\\Users\\oigla\\anaconda3\\lib\\site-packages\\pandas\\core\\tools\\datetimes.py:430\u001b[0m, in \u001b[0;36m_convert_listlike_datetimes\u001b[1;34m(arg, format, name, tz, unit, errors, infer_datetime_format, dayfirst, yearfirst, exact)\u001b[0m\n\u001b[0;32m    427\u001b[0m         \u001b[38;5;28mformat\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m    429\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mformat\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m--> 430\u001b[0m     res \u001b[38;5;241m=\u001b[39m \u001b[43m_to_datetime_with_format\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m    431\u001b[0m \u001b[43m        \u001b[49m\u001b[43marg\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43morig_arg\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtz\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mformat\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexact\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merrors\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43minfer_datetime_format\u001b[49m\n\u001b[0;32m    432\u001b[0m \u001b[43m    \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    433\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m res \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m    434\u001b[0m         \u001b[38;5;28;01mreturn\u001b[39;00m res\n",
      "File \u001b[1;32mc:\\Users\\oigla\\anaconda3\\lib\\site-packages\\pandas\\core\\tools\\datetimes.py:538\u001b[0m, in \u001b[0;36m_to_datetime_with_format\u001b[1;34m(arg, orig_arg, name, tz, fmt, exact, errors, infer_datetime_format)\u001b[0m\n\u001b[0;32m    535\u001b[0m         \u001b[38;5;28;01mreturn\u001b[39;00m _box_as_indexlike(result, utc\u001b[38;5;241m=\u001b[39mutc, name\u001b[38;5;241m=\u001b[39mname)\n\u001b[0;32m    537\u001b[0m \u001b[38;5;66;03m# fallback\u001b[39;00m\n\u001b[1;32m--> 538\u001b[0m res \u001b[38;5;241m=\u001b[39m \u001b[43m_array_strptime_with_fallback\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m    539\u001b[0m \u001b[43m    \u001b[49m\u001b[43marg\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtz\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfmt\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexact\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merrors\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43minfer_datetime_format\u001b[49m\n\u001b[0;32m    540\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    541\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m res\n",
      "File \u001b[1;32mc:\\Users\\oigla\\anaconda3\\lib\\site-packages\\pandas\\core\\tools\\datetimes.py:473\u001b[0m, in \u001b[0;36m_array_strptime_with_fallback\u001b[1;34m(arg, name, tz, fmt, exact, errors, infer_datetime_format)\u001b[0m\n\u001b[0;32m    470\u001b[0m utc \u001b[38;5;241m=\u001b[39m tz \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mutc\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m    472\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 473\u001b[0m     result, timezones \u001b[38;5;241m=\u001b[39m \u001b[43marray_strptime\u001b[49m\u001b[43m(\u001b[49m\u001b[43marg\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfmt\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexact\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mexact\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merrors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43merrors\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    474\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m OutOfBoundsDatetime:\n\u001b[0;32m    475\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m errors \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mraise\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n",
      "File \u001b[1;32mc:\\Users\\oigla\\anaconda3\\lib\\site-packages\\pandas\\_libs\\tslibs\\strptime.pyx:150\u001b[0m, in \u001b[0;36mpandas._libs.tslibs.strptime.array_strptime\u001b[1;34m()\u001b[0m\n",
      "\u001b[1;31mValueError\u001b[0m: time data '2024-02-29' does not match format 'mixed' (match)"
     ]
    }
   ],
   "source": [
    "# Открываем zip-архив\n",
    "with zipfile.ZipFile(f'{path}/sessions_successful (2).zip', 'r') as zf:\n",
    "    # Получаем список файлов в архиве\n",
    "    file_names = zf.namelist()\n",
    "    success = pd.DataFrame()\n",
    "    counter = 1\n",
    "    for file_name in file_names:\n",
    "        # Читаем содержимое файлов\n",
    "        with zf.open(file_name) as file:\n",
    "            try:\n",
    "                file_data = pd.read_csv(file, sep=';', low_memory=False, )\n",
    "            except Exception as e:\n",
    "                print(f'Ошибка при чтении файла \"{file_name}\" : [{e}]')\n",
    "            print(f'Обрабатывается файл \"{counter}\" : {file_name}')\n",
    "                # переименование столбцов\n",
    "            file_data.rename(\n",
    "                columns={'Дата': 'date_ts',\n",
    "                            'Post_name': 'post_name', \n",
    "                            'Название субъекта РФ': 'region_name', \n",
    "                            'Тип записи':'record_type',\n",
    "                    }, inplace=True\n",
    "                )\n",
    "            # создаем новые поля, одно с именем файла, другое с общим количеством строк в файле\n",
    "            file_data['source_file_name'] = file_name\n",
    "            file_data['total_rows_in_file'] = file_data.shape[0]\n",
    "            # file_data = file_data.loc[:, ~file_data.columns.str.contains(' ')]\n",
    "            # file_data.drop_duplicates(subset='session_id')\n",
    "            file_data['date_ts'] = pd.to_datetime(file_data['date_ts'], format='mixed', errors='coerce')\n",
    "            file_data['slot_ts'] = pd.to_datetime(file_data['slot_ts'], format='mixed', errors='coerce')\n",
    "            file_data['create_ts'] = pd.to_datetime(file_data['create_ts'], format='mixed', errors='coerce')\n",
    "            # запись в БД\n",
    "            file_data.to_sql('session_success', engine, if_exists='append', index=False, chunksize=1000, schema='db02')\n",
    "            counter += 1\n",
    "#             success = pd.concat([file_data, success], ignore_index=True)\n",
    "# print(success.columns, success.shape) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date_ts</th>\n",
       "      <th>session_id</th>\n",
       "      <th>region_name</th>\n",
       "      <th>sp_oid</th>\n",
       "      <th>sp_name</th>\n",
       "      <th>post_name</th>\n",
       "      <th>slot_ts</th>\n",
       "      <th>create_ts</th>\n",
       "      <th>record_type</th>\n",
       "      <th>source_file_name</th>\n",
       "      <th>total_rows_in_file</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2024-03-12</td>\n",
       "      <td>3816962669</td>\n",
       "      <td>Краснодарский край</td>\n",
       "      <td>1.2.643.5.1.13.13.12.2.23.1868.0.214030</td>\n",
       "      <td>Детская поликлиника ГБУЗ \"Белореченская ЦРБ\" М...</td>\n",
       "      <td>врач - детский хирург</td>\n",
       "      <td>2024-03-25 08:30:00+03:00</td>\n",
       "      <td>2024-03-12 00:22:09.675000+03:00</td>\n",
       "      <td>3</td>\n",
       "      <td>И38_успешные_сессии_20240312.csv</td>\n",
       "      <td>157847</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2024-03-12</td>\n",
       "      <td>3816937728</td>\n",
       "      <td>Краснодарский край</td>\n",
       "      <td>1.2.643.5.1.13.13.12.2.23.2009.0.408844</td>\n",
       "      <td>ГБУЗ \"Детская городская поликлиника № 1 г. Кра...</td>\n",
       "      <td>врач-травматолог-ортопед</td>\n",
       "      <td>2024-03-22 11:00:00+03:00</td>\n",
       "      <td>2024-03-12 00:18:44.048000+03:00</td>\n",
       "      <td>3</td>\n",
       "      <td>И38_успешные_сессии_20240312.csv</td>\n",
       "      <td>157847</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2024-03-12</td>\n",
       "      <td>3816858132</td>\n",
       "      <td>Липецкая область</td>\n",
       "      <td>1.2.643.5.1.13.13.12.2.48.4504.0.204574</td>\n",
       "      <td>Консультативно-диагностическое отделение, ГУЗ ...</td>\n",
       "      <td>врач-дерматовенеролог</td>\n",
       "      <td>2024-03-12 10:20:00+03:00</td>\n",
       "      <td>2024-03-12 00:08:16.989000+03:00</td>\n",
       "      <td>3</td>\n",
       "      <td>И38_успешные_сессии_20240312.csv</td>\n",
       "      <td>157847</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2024-03-12</td>\n",
       "      <td>3816922375</td>\n",
       "      <td>Московская область</td>\n",
       "      <td>1.2.643.5.1.13.13.12.2.50.4782.0.150680</td>\n",
       "      <td>Детское лечебно-профилактическое отделение ГАУ...</td>\n",
       "      <td>врач-стоматолог детский</td>\n",
       "      <td>2024-03-13 17:45:00+03:00</td>\n",
       "      <td>2024-03-12 00:16:42.414000+03:00</td>\n",
       "      <td>3</td>\n",
       "      <td>И38_успешные_сессии_20240312.csv</td>\n",
       "      <td>157847</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2024-03-12</td>\n",
       "      <td>3817014851</td>\n",
       "      <td>Калужская область</td>\n",
       "      <td>1.2.643.5.1.13.13.12.2.40.3788.0.100705</td>\n",
       "      <td>Поликлиника при Больнице Воротынск,ГБУЗ КО «ЦР...</td>\n",
       "      <td>врач-терапевт участковый</td>\n",
       "      <td>2024-03-22 14:30:00+03:00</td>\n",
       "      <td>2024-03-12 00:31:08.965000+03:00</td>\n",
       "      <td>3</td>\n",
       "      <td>И38_успешные_сессии_20240312.csv</td>\n",
       "      <td>157847</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     date_ts  session_id         region_name  \\\n",
       "0 2024-03-12  3816962669  Краснодарский край   \n",
       "1 2024-03-12  3816937728  Краснодарский край   \n",
       "2 2024-03-12  3816858132    Липецкая область   \n",
       "3 2024-03-12  3816922375  Московская область   \n",
       "4 2024-03-12  3817014851   Калужская область   \n",
       "\n",
       "                                    sp_oid  \\\n",
       "0  1.2.643.5.1.13.13.12.2.23.1868.0.214030   \n",
       "1  1.2.643.5.1.13.13.12.2.23.2009.0.408844   \n",
       "2  1.2.643.5.1.13.13.12.2.48.4504.0.204574   \n",
       "3  1.2.643.5.1.13.13.12.2.50.4782.0.150680   \n",
       "4  1.2.643.5.1.13.13.12.2.40.3788.0.100705   \n",
       "\n",
       "                                             sp_name  \\\n",
       "0  Детская поликлиника ГБУЗ \"Белореченская ЦРБ\" М...   \n",
       "1  ГБУЗ \"Детская городская поликлиника № 1 г. Кра...   \n",
       "2  Консультативно-диагностическое отделение, ГУЗ ...   \n",
       "3  Детское лечебно-профилактическое отделение ГАУ...   \n",
       "4  Поликлиника при Больнице Воротынск,ГБУЗ КО «ЦР...   \n",
       "\n",
       "                  post_name                   slot_ts  \\\n",
       "0     врач - детский хирург 2024-03-25 08:30:00+03:00   \n",
       "1  врач-травматолог-ортопед 2024-03-22 11:00:00+03:00   \n",
       "2     врач-дерматовенеролог 2024-03-12 10:20:00+03:00   \n",
       "3   врач-стоматолог детский 2024-03-13 17:45:00+03:00   \n",
       "4  врач-терапевт участковый 2024-03-22 14:30:00+03:00   \n",
       "\n",
       "                         create_ts  record_type  \\\n",
       "0 2024-03-12 00:22:09.675000+03:00            3   \n",
       "1 2024-03-12 00:18:44.048000+03:00            3   \n",
       "2 2024-03-12 00:08:16.989000+03:00            3   \n",
       "3 2024-03-12 00:16:42.414000+03:00            3   \n",
       "4 2024-03-12 00:31:08.965000+03:00            3   \n",
       "\n",
       "                   source_file_name  total_rows_in_file  \n",
       "0  И38_успешные_сессии_20240312.csv              157847  \n",
       "1  И38_успешные_сессии_20240312.csv              157847  \n",
       "2  И38_успешные_сессии_20240312.csv              157847  \n",
       "3  И38_успешные_сессии_20240312.csv              157847  \n",
       "4  И38_успешные_сессии_20240312.csv              157847  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "success.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 346997 entries, 0 to 346996\n",
      "Data columns (total 11 columns):\n",
      " #   Column              Non-Null Count   Dtype                    \n",
      "---  ------              --------------   -----                    \n",
      " 0   date_ts             346997 non-null  datetime64[ns]           \n",
      " 1   session_id          346997 non-null  int64                    \n",
      " 2   region_name         346997 non-null  object                   \n",
      " 3   sp_oid              342214 non-null  object                   \n",
      " 4   sp_name             346997 non-null  object                   \n",
      " 5   post_name           346997 non-null  object                   \n",
      " 6   slot_ts             346997 non-null  datetime64[ns, UTC+03:00]\n",
      " 7   create_ts           346997 non-null  datetime64[ns, UTC+03:00]\n",
      " 8   record_type         346997 non-null  int64                    \n",
      " 9   source_file_name    346997 non-null  object                   \n",
      " 10  total_rows_in_file  346997 non-null  int64                    \n",
      "dtypes: datetime64[ns, UTC+03:00](2), datetime64[ns](1), int64(3), object(5)\n",
      "memory usage: 29.1+ MB\n"
     ]
    }
   ],
   "source": [
    "success.info()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
